//
//  LoadingScreenView.m
//  ZooNgonDoiOS
//
//  Created by Trung sound on 7/13/12.
//  Copyright (c) 2012 Personal. All rights reserved.
//

#import "LoadingScreenView.h"

@implementation LoadingScreenView

- (void)layoutSubviews {
    _vLoading = [[UIView alloc]initWithFrame:CGRectMake((self.bounds.size.width-296)/2, (self.bounds.size.height-70)/2, 296, 80)];
    _vLoading.backgroundColor = [UIColor blueColor];
    _lbLoading = [[UILabel alloc]initWithFrame:CGRectMake(100, (_vLoading.bounds.size.height-30)/2, 170, 30)];
    [_lbLoading setText:PROGRESS_LOADING];
    [_lbLoading setFont:[UIFont fontWithName:APP_MAIN_FONT size:15]];
    [_lbLoading setBackgroundColor:[UIColor clearColor]];

    _animateImageView = [[UIImageView alloc]initWithFrame:CGRectMake(20, (_vLoading.bounds.size.height-78)/2, 78, 78)];
    _animateImageView.animationImages = [NSArray arrayWithObjects:
                                         [UIImage imageNamed:@"loading1.gif"], 
                                         [UIImage imageNamed:@"loading2.gif"], 
                                         [UIImage imageNamed:@"loading3.gif"],
                                         [UIImage imageNamed:@"loading4.gif"],
                                         [UIImage imageNamed:@"loading5.gif"],
                                         [UIImage imageNamed:@"loading6.gif"],nil];
    _animateImageView.animationDuration = 1.0f;
    _animateImageView.animationRepeatCount = 0;
    [_animateImageView startAnimating];
    
    [_vLoading addSubview:_animateImageView];
    [_vLoading addSubview:_lbLoading];
    [self addSubview:_vLoading];
}

@end
